// 引入request模块
import request from '@/utils/request'

// 添加按条件查询角色接口 /boss/role/getRolePages
export const getRoles = data => {
  return request({
    method: 'POST',
    url: '/boss/role/getRolePages',
    data
  })
}
// 添加获取删除角色接口 /boss/role/{id}
export const deleteRole = id => {
  return request({
    method: 'DELETE',
    url: `/boss/role/${id}`
  })
}
// 保存或者更新角色接口  /boss/role/saveOrUpdate
export const saveOrUpdate = data => {
  return request({
    method: 'POST',
    url: '/boss/role/saveOrUpdate',
    data
  })
}
// 获取角色接口 /boss/role/{id}
export const getRoleById = id => {
  return request({
    method: 'GET',
    url: `/boss/role/${id}`
  })
}
// 获取所有角色
export const getAllRole = () => {
  return request({
    method: 'GET',
    url: '/boss/role/all'
  })
}
// 给用户分配角色  /boss/role/allocateUserRoles
export const allocateUserRoles = data => {
  return request({
    method: 'POST',
    url: '/boss/role/allocateUserRoles',
    data
  })
}
// 查询用户角色接口----查询指定的用户有什么角色 /boss/role/user/{userId}
export const getUserRoles = userId => {
  return request({
    method: 'GET',
    url: `/boss/role/user/${userId}`
  })
}
